import * as PIXI from 'pixi.js'
import useMainStore from '@renderer/store/modules/useMainStore'

export default async (): Promise<void> => {
  const mainStore = useMainStore()
  const { scale } = mainStore.getAppAttr
  const app = await mainStore.getApp()
  const mainContainer = app.stage.getChildByLabel('main')
  // 背景层
  const bundle = await PIXI.Assets.loadBundle('cardBook')
  const bgTexture = new PIXI.Sprite(bundle.HallBG_Back)
  bgTexture.anchor.set(0.5)
  bgTexture.position.set(app.screen.width / 2, app.screen.height / 2)
  bgTexture.scale.set(app.canvas.width / bgTexture.width)
  bgTexture.scale.set(1 / scale)
  mainContainer!.addChild(bgTexture)
}
